package com.scau.ums.service.factory;

import com.scau.ums.model.User;
import com.scau.ums.service.UserInfo;
import com.scau.ums.service.imp.userInfo.MaintainerInfoImp;
import com.scau.ums.service.imp.userInfo.StudentInfoImp;
import com.scau.ums.service.imp.userInfo.TeacherInfoImp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class UserInfoImpFactory {

    private StudentInfoImp studentInfoImp;
    private TeacherInfoImp teacherInfoImp;
    private MaintainerInfoImp maintainerInfoImp;

    @Autowired
    public UserInfoImpFactory(StudentInfoImp studentInfoImp, TeacherInfoImp teacherInfoImp,MaintainerInfoImp maintainerInfoImp) {
        this.studentInfoImp = studentInfoImp;
        this.teacherInfoImp = teacherInfoImp;
        this.maintainerInfoImp = maintainerInfoImp;
    }

    public UserInfo getUserInfoImp(int Type)
    {
        switch (Type)
        {
            case User.STUDENT:return studentInfoImp;
            case User.TEACHER:return teacherInfoImp;
            case User.MAINTAINER:return maintainerInfoImp;
            default:return null;
        }
    }
}
